<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
console.log('start')

function test () {
  console.log('start-test')
  
  return new Promise((resolve, reject) => {
    console.log('promise');
    
    setTimeout(() => {
      console.log('setTimeout');
    }, 0)

    resolve();
    reject();
  })

  console.log('end-test');
}

test()
  .then(() => {
    console.log('then');
  })
  .catch(() => {
    console.log('catch')
  })
    </script>
</body>
</html>